﻿using GuanQL.Core.Domain.Medias;
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
using System;
using System.ComponentModel.DataAnnotations;
using ZhongJia.Core.Consts;
using ZhongJia.Core.Utility;

namespace GuanQL.Core.Domain.Accounts
{
    public class User : IdentityUser<Guid, IdentityUserClaim<Guid>, UserRole, IdentityUserLogin<Guid>>, IBaseEntity
    {
        public User()
        {
            LastestOperTime = SystemClock.Now;
        }

        public bool IsDeleted { get; set; }

        public Guid TenantId { get; set; }

        public Guid AvatarId { get; set; }

        public Picture Avatar { get; set; }

        [MaxLength(Validations.GeneralShortestLength)]
        public string NickName { get; set; }

        public DateTime LastestOperTime { get; set; }

        public string GetDisplayName()
        {
            return NickName ?? Name;
        }

        [MaxLength(Validations.GeneralShortestLength)]
        public string Name { get; set; }


        [MaxLength(Validations.GeneralLength)]
        public string DeviceToken { get; set; }


        public decimal Amount { get; set; }
    }
}
